AddComment
Adds a comment to all contents of the current table. 💡 Please note that this table must be in the document.
Syntax
expression.AddComment(sText, sAuthor, sUserId);
expression
- A variable that represents a ApiTable class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
sText | Required | string | The comment text (required). | |
sAuthor | Required | string | The author's name (optional). | |
sUserId | Required | string | The user ID of the comment author (optional). |
Returns
Example
This example adds a comment to all contents of the table.
let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetWidth("percent", 100);
table.SetStyle(tableStyle);
doc.Push(table);
let paragraph = Api.CreateParagraph();
paragraph.AddText("This is just a sample text in the first cell.");
let cell = table.GetCell(0, 0);
table.AddElement(cell, 0, paragraph);
table.AddComment("comment", "John Smith");